<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>省市级代理商</title>
		<link rel="stylesheet" href="__OEM__/css/iconfont.css" />
		<link rel="stylesheet" href="__OEM__/css/css.css" />
	</head>

	<body>
		{include file="public/header" /}
		<div class="index_conbox">
			<div class="index_content clearfix">
				{include file="public/lefter" /}
				<div class="right">
					<!--右侧内容-->
					<div class="rigtop">
						<span class="title">市级代理商</span>
					</div>	
					<div class="indrig_con" style="position: relative;">
						{if $Think.session.user_level==1 && $Think.session.user_type==1}
						<div class="zizh_btnbox" style="top: -58px;right:30px">
							<button class="zizh_btn" type="button"><i class="iconfont icon-jia"></i>增加市代理</button>
						</div>
						{/if}
						<div class="zizh_conbox">
								<form id="my_form" action="{:url('accounts/agency_id1')}" method="post">
									<div class="shxx_row chax_row clearfix">
										{if $Think.session.user_level==1}
										<div class="left">省级代理：</div>
										<div class="right clearfix">
											<div id="htselect">
												<select name="province_id" id="ch_city">
													<option value="">全部</option>
													{volist name="province" id="str"}
													<option {if $province_id==$str.id} selected {/if} value="{$str.id}">{$str.user_name}</option>
													{/volist}
												</select>
											</div>
										</div>
										{/if}
										<div class="left"  style="margin-left: 10px;">市代理手机号：</div>
										<div class="right clearfix">
													<input type="text" name="mobile" id="mobile" value="{$mobile?$mobile:''}" placeholder="市代理手机号" class="chax_input" />
										</div>
										<div class="left"  style="margin-left: 10px;">市代理名称：</div>
										<div class="right clearfix">							
													<input type="text" name="user_name" id="user_name" value="{$user_name?$user_name:''}" placeholder="市代理名称" class="chax_input" />
										</div>
										<button type="submit" onclick="return check_time()" class="htcxbtn">搜索</button>
									</div>
								</form>
	
							<!--选项卡内容开始-->
							<div class="zizh_con_1">
								<div class="chax_conbox">
									<div class="chax_jiegnr">
										<table class="zizh_table1 zizh_table2">
											<thead>
												<tr style="text-align: center;">
													<th style="width: 6%;">代理商ID</th>
													<th style="width: 6%;">代理商<br />名称</th>
													<th style="width: 6%;">手机号</th>	
													<th style="width: 6%;">代理</br>城市</th>
													<th style="width: 6%;">省代</th>						
													<th style="width: 5%;">余额</th>
													<th style="width: 5%;">是否<br />认证</th>
													<th style="width: 7%;">运营商数</th>
													<th style="width: 5%;">状态</th>
													<th style="width: 7%;">新会员<br />送鼓励金</th>
													<th style="width: 5%;">分佣<br />比例</th>
													<th style="width: 5%;">绑定<br />商家id</th>
													<th style="width: 8%;">创建时间</th>
													<th style="width: 5%;">代理<br />形式</th>
													<th style="width: 6%;">操作</th>
												</tr>
											</thead>
											<tbody id="tbody">
												{volist name="list" id="ad" empty="$empty"}
												<tr style="text-align: center;">
													<td>{$ad.id}</td>
													<td>{$ad.user_name}</td>
													<td>{$ad.mobile}</td>
													<td>{$ad.province}</br>{$ad.city}</td>
													<td><?php if($ad['province_id']){
														$province_name=db('info_oem')->where("id",$ad['province_id'])->find();	
														echo $province_name['user_name'];
													} ?></td>
													<!-- <td>{$ad.address}</td> -->								
													<td>
														<a href="{:url('index/yue_record1',['id'=>$ad.id])}">
														<?php echo substr($ad['balance'],0,strlen($ad['balance'])-2);?>
														</a>
													</td>
													<td>
														{if $ad.is_verify==1}
														是
														{else/}
														否
														{/if}
													</td>
													<td>
														<a href="/oem/accounts/agency_id2/agency_id/{$ad['id']}">
															{$ad.count?$ad.count : 0}
														</a>
													</td>
													<td>
														{if $ad.status==1}
														正常
														{else/}
														冻结
														{/if}
													</td>
													<td>{$ad.s_score}</td>
													
													<td>{$ad.oem_bili}%</td>
													<td>{$ad.ome_agent_id}</td>
													<td>{$ad.add_time|substr=0,10}</td>
													<td>{if $ad.oem_level==1}正式{/if}{if $ad.oem_level==2}自营{/if}</td>
													<td>
														{if $Think.session.user_level==1}
														<a onclick="open_edit('{$ad.id}')">编辑</a>
														{/if}
														<a href="javascript:;" onclick="agent_count('{$ad.id}','1')">统计</a>
													</td>
												</tr>
												{/volist}
											</tbody>
										</table>
										<div class="fenye" style="display: block;">
											<ul class="pagination">
												{$list->render()}
											</ul>
										</div>
									</div>
								</div>
							</div>
						</div>

					</div>
				</div>
			</div>
		</div>
		{include file="public/footer" /}

	</body>
	<script>
		$(".zizh_btn").click(function() {
			layer.open({
				type: 2,
				title: '增加市代理商',
				shadeClose: true,
				shade: 0.8,
				area: ['640px', '740px'],
				content: "{:url('accounts/add_agency1')}"
			});
		})

		function open_edit(id) {
			var url = 'edit_agency1?id=' + id;
			layer.open({
				type: 2,
				title: '编辑市代理商',
				shadeClose: true,
				shade: 0.8,
				area: ['640px', '780px'],
				content: [url]
			});
		}
		function show_city_pt(city_id){
			
			var show_url = "{:url('accounts/show_oem_pt')}"+'?province_id='+city_id;
			
			layer.open({
				type: 2,
				title: '设置推荐人',
				shadeClose: true,
				shade: 0.8,
				area: ['460px', '260px'],
				content: show_url
			});
		}
		function clear_pt(id){
			 layer.confirm('确认要清空推荐人吗？', {
            btn : [ '确定', '取消' ]//按钮
	        }, function(index) {
	            $.ajax({
	            	type:"post",
	            	data:{id:id},
	            	url:"{:url('accounts/clear_pt')}",
	            	success:function(data){
	            		layer.msg(data.msg, {
						  icon: 1,
						  time: 2000 //2秒关闭（如果不配置，默认是3秒）
						}, function(){
						   
						})
	            	}
	            });
	       		
	        });
		}
		
		function show_score(id){
			
			var show_url = "{:url('accounts/show_score')}"+'?type=1&id='+id;
			
			layer.open({
				type: 2,
				title: '鼓励金记录',
				shadeClose: true,
				shade: 0.8,
				area: ['775px', '700px'],
				content: show_url
			});
		}
		
		function show_member(id){
			
			var show_url = "{:url('accounts/show_member')}"+'?id='+id;
			
			layer.open({
				type: 2,
				title: '推广数',
				shadeClose: true,
				shade: 0.8,
				area: ['800px', '730px'],
				content: show_url
			});
		}
		
		//数据统计
		function agent_count(id){
			var show_url = "{:url('accounts/oem_count')}"+'?id='+id+'&level=1';
			layer.open({
				type: 2,
				title: '数据统计',
				shadeClose: true,
				shade: 0.8,
				area: ['900px', '730px'],
				content: show_url
			});
		}
	</script>

</html>
